package com.axjy.service.impl;

import com.axjy.mapper.RoleMapper;
import com.axjy.mapper.UserMapper;
import com.axjy.pojo.Role;
import com.axjy.pojo.User;
import com.axjy.service.RoleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by dell on 2017/10/30.
 */
@Service("roleService")
@Transactional
public class RoleServiceImpl implements RoleService {

    @Resource
    private RoleMapper roleMapper;
    @Resource
    private UserMapper userMapper;

    @Override
    public List<Role> list() {
        return roleMapper.list();
    }

    @Override
    public void add(Role role) {
        roleMapper.add(role);
    }

    @Override
    public List<User> getUserById(Integer roleId) {
        return userMapper.getUserByRoleId(roleId);
    }
}
